<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
		+ request.getServerName() + ":" + request.getServerPort()
		+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<script type="text/javascript" src="<%=path %>/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="<%=path %>/js/global.js"></script>
 
   <script type="text/javascript">
   $(function (){
	   $('#outLand').on('click',function(){
		  var url1 = "<%=path %>/login/outLand";
		  var action1  = {};
		  var result = ajaxWithServer(url1,action1);
		   if(result.result){
			   if(result.data.outLand == "SUCCESS")
					//刷新
					window.location.reload();
				else
					alert("系统繁忙，请稍后再试");
			   
		   }
		   
	   });
	   
	   
	   
	   var action = {};
	   var url = "<%=path %>/nav/listNav";
	   var nav_ul = $('#nav_ul');
	   nav_ul.empty();
	   var result = ajaxWithServer(url,action);
	   if(result.result){
		   //成功
		   var group = "";
		   var lis = result.data;
		  // alert("当前nav:"+currentNav);
		   $.each(lis,function(){
			   if('' == currentNav){
				   currentNav = this.id;
			   }
			 	//alert("便利到的nav:"+this.id);
			   if(currentNav == this.id){
				   group +="<li  class='hover' id='"+this.id+"'><a href='<%=path %>/"+this.navUrl+"'>"+this.navName+"</a></li>";
			   }else{
				   group +="<li id='"+this.id+"'><a href='<%=path %>/"+this.navUrl+"'>"+this.navName+"</a></li>";
			   }
		   });
		   nav_ul.append(group);
	   }else{
		   alert("系统出现错误，请联系管理员！");
	   }
	   nav_ul.find('li').on('click',function(){
		   var index = $(this).attr('id');
		   //alert("点击时的id值为:"+index);
		   currentNav = index;
	   });
	   
   });
   </script>


<div class="nav_es">
    <div class="nav_es_top">
        <div class="nav_es_top_es">
            <ul id="nav_ul">
                <!-- <li><a href="/home/">首页</a></li>
                <li class="hover"><a href="/meishi/">特色美食</a></li>
                <li><a href="/auto/">汽车</a></li>
                <li><a href="/wed/">婚嫁</a></li>
                <li><a href="/hotel/shop/">酒店</a></li>
                <li><a href="/store/shop/">综合</a></li>
                <li><a href="/store/">首页</a></li>
                <li><a href="/baby/">亲子</a></li> -->
            </ul>
             <div class="nav_es_right" id="session_div">
             <%-- ${sessionScope.currentUser.getRole().getId()} --%>
	             <c:choose>
	             	<c:when test="${sessionScope.currentUser ne null}">
	             		<c:choose>
	             			<c:when test="${sessionScope.currentUser.role.id eq 1}">
	             				<a href="javascript:void(0)">个人中心</a>|
	             			</c:when>
	             			<c:when test="${sessionScope.currentUser.role.id eq 3}">
	             				<a href="<%=path %>/business/home">管理中心</a>|
	             			</c:when>
	             			<c:otherwise>
	             				<a href="<%=path %>/adminstrotor/adminstrotorHome">管理员中心</a>|
	             			</c:otherwise>
	             		</c:choose>
	             		
	             	
	             		<a id="outLand" href="javascript:void(0)">注销</a>
	             	</c:when>
	             	<c:otherwise>
	             		<a href="<%=path %>/login/login">登陆</a>|<a href="<%=path %>/login/reregist">用户注册</a>|<a href="<%=path %>/login/reregistBusi">商家注册</a>
	             	</c:otherwise>
	             </c:choose>
       		</div>
        </div>
    </div>
</div>